home *** CD-ROM | disk | FTP | other *** search
/ Computer Select (Limited Edition) / Computer Select.iso / pcmag / v10n18 / rmvspc.wfw < prev    next >
Encoding:
Text File  |  1991-07-26  |  2.4 KB  |  118 lines

  1. Sub MAIN
  2. REM Begin macro
  3.  
  4. On Error Goto Quit
  5. REM If error occurs, go to Quit 
  6. REM subroutine 
  7.  
  8. PageView = ViewPage() 
  9. REM Define ViewPage function with
  10. REM current values as "PageView"
  11.  
  12. Rough = ViewDraft()
  13. REM Define ViewDraft function with
  14. REM current values as "Rough"
  15.  
  16. ViewDraft - 1
  17. REM Turn draft mode on
  18.  
  19. OKChar$ = ".:!?"
  20. REM Period, colon, exclamation, and
  21. REM question defined in char string
  22.  
  23. LOG = - 1
  24. REM When text found, extend select once
  25. REM to left
  26.  
  27. InsertBookmark .Name = "Here"
  28. REM Insert a Bookmark with the name
  29. REM "Here" 
  30.  
  31. On Error Goto Break
  32. REM If an error occurs go to Break
  33. REM subroutine 
  34.  
  35. StartOfDocument
  36. REM Go to beginning of document
  37.  
  38. While LOG = - 1
  39. REM As long as search is successful...
  40.  
  41. EditSearch .Search = "?  ", .WholeWord = 0, .MatchCase = 0, .Direction = 2, .Format = 0
  42.  
  43. REM ...do not look for whole word or
  44. REM matched upper and lower case,
  45. REM search toward end of document, and
  46. REM ignore formatting
  47.  
  48. If SelType() <> 2 Then Goto Break
  49. REM If selected text is not solid, to
  50. REM Break subroutine
  51.  
  52. LOG = EditSearchFound() 
  53. REM Define EditSearchFound function as
  54. REM "LOG"
  55.  
  56. If InStr(OKChar$, Left$(Selection$(), 1)) = 0 Then
  57. REM If a period or colon is not found
  58. REM to left of selected source text,
  59. REM then...
  60.  
  61. CharLeft 1 : CharRight 1 : CharRight 1, 1
  62. REM ...extend selection once to left,
  63. REM once to right, then right again
  64.  
  65. Reply = MsgBox("Remove extra space ?", "Double space", 3)
  66. REM Define MsgBox function with message
  67. REM and title, including Yes, No, and
  68. REM Cancel buttons as "Reply"
  69.  
  70. If Reply = - 1 Then
  71. REM If Yes button chosen...
  72.  
  73. EditClear - 1
  74. REM ...delete the selected text from
  75. REM one char to left of insertion point
  76.  
  77. ElseIf Reply = 1 Then
  78. REM Otherwise, if Cancel button
  79. REM chosen...
  80.  
  81. Goto Quit
  82. REM ...go to Quit subroutine
  83.  
  84. End If
  85. REM End the current If subroutine
  86.  
  87. CharLeft 1
  88. REM Move the cursor once to the left
  89.  
  90. End If
  91. REM End this If subroutine
  92.  
  93. Wend
  94. REM End While subroutine
  95.  
  96. Break:
  97. REM "Break" subroutine
  98.  
  99. EditGoTo .Destination = "Here"
  100. REM Move cursor to "Here" Bookmark
  101.  
  102. InsertBookmark .Name = "Here", .Delete
  103. REM Delete Bookmark
  104.  
  105. Quit:
  106. REM "Quit" subroutine
  107.  
  108. If PageView Then ViewPage PageView
  109. REM If in ViewPage mode, return to that
  110. REM mode 
  111.  
  112. If Not Rough Then ViewDraft Rough
  113. REM If not in draft mode, go to draft
  114. REM mode 
  115.  
  116. End Sub
  117. REM End macro
  118.